﻿using System;

namespace FrameWork.Core.Aggregator
{
    public interface IChainAggregator<C, P, R>
    {
        /// <summary>
        /// 立即执行
        /// </summary>
        /// <param name="record"></param>
        P CreateAndRun(R record);
        /// <summary>
        /// 同步线程，排队任务
        /// </summary>
        /// <param name="record"></param>
        /// <param name="startAction"></param>
        /// <param name="endAction"></param>
        void CreateAndRunWithQueue(R record);
        /// <summary>
        /// 同步执行,同一时只执行一个任务
        /// </summary>
        /// <param name="record"></param>
        /// <param name="startAction"></param>
        /// <param name="endAction"></param>
        void CreateAndRunWithMonopoly(R record);
        /// <summary>
        /// 异步执行
        /// </summary>
        /// <param name="record"></param>
        /// <param name="startAction"></param>
        /// <param name="endAction"></param>
        void CreateAndRunWithAsync(R record);
    }
}